#创建目录
mkdir -p /home/nfs/nginx/www /home/nfs/nginx/logs /home/nfs/nginx/conf /home/nfs/nginx/conf.d /home/nfs/nginx/conf.d/ssl

#复制nginx配置
docker run -d --rm --name tmp_nginx nginx
docker cp tmp_nginx:/etc/nginx/nginx.conf /home/nfs/nginx/conf
docker cp tmp_nginx:/etc/nginx/conf.d /home/nfs/nginx
docker cp tmp_nginx:/usr/share/nginx/html /home/nfs/nginx/
docker kill tmp_nginx

#运行容器
docker kill nginx
docker rm nginx
docker run -d --name nginx --network=host --log-opt max-size=100m --log-opt max-file=3 \
-v /home/nfs/nginx/www:/usr/share/nginx/www \
-v /home/nfs/nginx/html:/usr/share/nginx/html \
-v /home/nfs/nginx/conf/nginx.conf:/etc/nginx/nginx.conf \
-v /home/nfs/nginx/conf.d:/etc/nginx/conf.d \
-v /home/nfs/nginx/logs:/var/log/nginx \
--restart=unless-stopped \
nginx
docker logs -f nginx